//
//  MainViewController.swift
//  GomroStore
//
//  Created by mac on 2020/11/20.
//

import UIKit


/// App主页面
class MainViewController: BaseViewController {

    //MARK: - override
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
    }
    
    override func updateViewConstraints() {
        
        self.mainView.snp.makeConstraints { make in
            make.left.right.equalTo(0)
            make.top.equalTo(K_APP_NAVIGATION_BAR_HEIGHT)
            make.bottom.equalTo(-K_APP_TABBAR_HEIGHT)
        }
        
        super.updateViewConstraints()
    }
    
    /** 添加视图 */
    override func addSubViews() {
       //未登录
       if !UserModel.userIsLogined {
           self.toLogin(Finish: nil)
       }
       
       self.view.addSubview(self.mainView)
    }
   
    /** 设置导航 */
    override func layoutNavigation() {
       //MARK:导航
       self.initNavgationBar(isBottomLine: false,
                             isShadow: false)
       
       //MARK:标题
       self.initViewControllerTitle(strTitle: K_APP_NAME,
                                     isBold: true)
    }
   
    /** 绑定事件 */
    override func bindViewModel() {
        
        ///...
    }
    
    //MARK: - lazy load
    private lazy var mainView:MainView = {
        let _mv  = MainView.init(ViewModel: self.viewModel)
        
        return _mv
    }()
    
    private lazy var viewModel:MainViewModel = {
        let _vm = MainViewModel()
        
        return _vm
    }()

}
